import Taro, {Component} from '@tarojs/taro'
import {Provider} from '@tarojs/redux'
import 'taro-ui/dist/style/index.scss'

import Index from './pages/index'

import configStore from './store'

import './app.less'

// 如果需要在 h5 环境中开启 React Devtools
// 取消以下注释：
// if (process.env.NODE_ENV !== 'production' && process.env.TARO_ENV === 'h5')  {
//   require('nerv-devtools')
// }

const store = configStore()

class App extends Component {
  config = {
    // 类似小程序
    pages: [
      'pages/index/index',
      'pages/my/my',
      'pages/shopping/shopping',
      'pages/sort/sort',
      'pages/goodsdetail/goodsdetail'
    ],
    // 类似小程序
    window: {
      backgroundTextStyle: 'light',
      // 顶部导航背景色
      navigationBarBackgroundColor: '#fff',
      // 顶部标题
      navigationBarTitleText: 'WeChat',
      // 顶部标题颜色
      navigationBarTextStyle: 'black'
    },
    tabBar: {
      color:'#333333',
      selectedColor:'#FF596F',
      backgroundColor: '#FFFFFF',
      list: [{
        pagePath: 'pages/index/index',
        text: '首页',
        iconPath:'./assets/index-normal.png',
        selectedIconPath:'./assets/index-selected.png'
      }, {
        pagePath: 'pages/sort/sort',
        text: '分类',
        iconPath:'./assets/sort-normal.png',
        selectedIconPath:'./assets/sort-selected.png'
      }, {
        pagePath: 'pages/shopping/shopping',
        text: '购物车',
        iconPath:'./assets/shopping-normal.png',
        selectedIconPath:'./assets/shopping-selected.png'
      }, {
        pagePath: 'pages/my/my',
        text: '我的',
        iconPath:'./assets/my-normal.png',
        selectedIconPath:'./assets/my-selected.png'
      }]
    }
  }

  componentDidMount() {
  }

  componentDidShow() {
  }

  componentDidHide() {
  }

  componentDidCatchError() {
  }

  // 在 App 类中的 render() 函数没有实际作用
  // 请勿修改此函数
  render() {
    return (
      <Provider store={store}>
        <Index/>
      </Provider>
    )
  }
}

Taro.render(<App/>, document.getElementById('app'))
